<%@page language="java" contentType="text/html;charset=utf-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title>用户管理</title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <link href="../../css/mine.css" type="text/css" rel="stylesheet">
        <script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
        <script type="text/javascript">
            $(function () {
               $("#dept").change(function () {
                   var  depid = $("#dept").val();
                   if(depid==-1){
                       alert("请选择所属部门")
                   }else{
                       $.ajax({
                           url:"/resouce/demo2/roleList",
                           data:"did="+depid,
                           type:"post",
                           dateType:"json",
                           success:function (rs) {
                           $("#rolelist")[0].length=0;
                           for(var i=0;i<rs.length;i++){
                               $("#rolelist")[0].add(new Option(rs[i].rname,rs[i].roleid));
                           }
                           }

                       })
                   }

               });
              //  var reflag=false;
              //  $("[name=employeenum]").blur(function () {
              //      var num =document.getElementById("num");
              //      var numvalue = num.value;
              //      if (numvalue==''||numvalue==null){
              //          $("[name=employeenum]").next().html("请输入编号");
              //      }else{
              //          var reg=/^e{1}m{1}p{1}[0-9]{3}$/;
              //          var b =reg.test(numvalue);
              //          if (b){
              //              reflag=true;
              //              $("[name=employeenum]").next().html("");
              //          }else{
              //              reflag=false;
              //              $("[name=employeenum]").next().html("请输入正确格式的编号");
              //          }
              //      }
              //  });
              //  var uflag=false;
              //  $(function () {
              //      $("[name=employeenum]").blur(function () {
              //          var numval = $(this).val();
              //          if (numval!=""){
              //               $.ajax({
              //                   url:"/resource/demo2/findNum",
              //                   data:"numval="+numval,
              //                   type:"post",
              //                   dataType:"json",
              //                   success:function (rs) {
              //                       if (rs!=null){
              //                           uflag=false;
              //                           $("[name=employeenum]").next().html("该账号已经存在");
              //                       }else{
              //                           uflag=true;
              //                           $("[name=employeenum]").next().html("");
              //                       }
              //                   }
              //               })
              //          }
              //
              //      })
              //  });
              // $(function () {
              //     $("#fo").submit(function () {
              //         if (reflag&&uflag){
              //             return true;
              //         }
              //         return false;
              //     })
              // });
            })
        </script>
    </head>

    <body>

        <div class="div_head">
            <span>
                <span style="float:left">当前位置是：-》资源管理》用户管理</span>
                <span style="float:right;margin-right: 8px;font-weight: bold">
                    <a style="text-decoration: none" href="list.jsp">【返回】</a>
                </span>
            </span>
        </div>
        <div></div>

        <div style="font-size: 13px;margin: 10px 5px">
            <form action="/resource/demo2/update" method="post" id="fo">
            <table border="1" width="100%" class="table_a">
                <input type="hidden" name="id" value="${emp.id}" >
                <tr>
                    <td width="120px;">用户编号<span style="color:red">*</span>：</td>
                    <td><input type="text" name="employeenum" id="num" value="${emp.employeenum}" readonly/><span style="color: red"></span></td>
                </tr>
                <tr>
                    <td>登录账号<span style="color:red">*</span>：</td>
                    <td>
                       <input type="text" name="loginname" value="${emp.loginname}" />
                    </td>
                </tr>
               
                <tr>
                    <td>用户姓名<span style="color:red">*</span>：</td>
                    <td>
						<input type="text" name="username" value="${emp.username}"/></td>
                </tr>
                <tr>
                    <td>密码<span style="color:red">*</span>：</td>
                    <td>
						<input type="password" name="loginpassword" value="${emp.loginpassword}"/>
					</td>
                </tr>
                <tr>
                    <td>所属部门<span style="color:red">*</span>：</td>
                    <td>

                        <select id="dept" name="deptid">
                            <option value="-1">请选择</option>
                            <c:forEach items="${dlist}" var="dep" varStatus="i">
                                <option value="${i.count}" ${emp.deptid==dep.deptid?"selected":""}>${dep.deptname}</option>
                            </c:forEach>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>所属职位<span style="color:red">*</span>：</td>
                    <td>
						<select id="rolelist" name="roleid">
                            <c:forEach items="${rolList}" var="rol">
                                <option value="${rol.roleid}" ${rol.roleid==emp.roleid?"selected":""}>${rol.rname}</option>
                            </c:forEach>
						</select>
                    </td>
                </tr>




				<tr>
                    <td>身份证<span style="color:red">*</span>：</td>
                    <td>
                        <input type="text" name="idcaid" value="${emp.idcaid}"/>
                    </td>                
                </tr>

				<tr>
                    <td>联系电话<span style="color:red">*</span>：</td>
                    <td>
                        <input type="text" name="telphone" value="${emp.telphone}"/>
                    </td>                
                </tr>

				<tr>
                    <td>邮箱<span style="color:red">*</span>：</td>
                    <td>
                        <input type="text" name="email" value="${emp.email}"/>
                    </td>                
                </tr>

				<tr>
                    <td>联系地址：</td>
                    <td>
                        <input type="text" name="address" value="${emp.address}"/>
                    </td>                
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="修改">
						<input type="reset" value="清空">
                    </td>
                </tr>  
            </table>
            </form>
        </div>
    </body>
</html>